Code:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
test1: Real;
RowNo: Integer;
begin
with (Sender as TDBGrid) do
begin
if (gdSelected in State) then
begin
Canvas.Brush.Color := clblue;
end
else
begin
rowno := Query1.RecNo;
test1 := (RowNo / 2) - trunc(RowNo / 2);
if test1 = 0 then
begin
farbe := clWhite
end
else
begin
farbe := clYellow;
end;
Canvas.Brush.Color := farbe;
Canvas.Font.Color := clBlack;
end;
Canvas.FillRect(Rect);
Canvas.TextOut(Rect.Left + 2, Rect.Top + 1, Column.Field.AsString);
end
end;
نظرات شما عزیزان: